package com.flash.DayProcessing.service.impl;

import com.flash.DayProcessing.entity.ValusStatistical;
import com.flash.DayProcessing.mapper.ValusStatisticalMapper;
import com.flash.DayProcessing.service.ValusStatisticalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
/**
 * 这是净值统计的实现类
 * @author Liy
 * @since 2022-8-24
 * @version 1.0
 */
@Service
@Transactional
public class ValusStatisticalServiceImpl implements ValusStatisticalService {

    @Autowired
    ValusStatisticalMapper valusStatisticalMapper;
    /**
     * 查询所有净值统计
     * @return 返回净值统计对象的集合
     */
    @Override
    public List<ValusStatistical> selectStatistical() {
        return valusStatisticalMapper.selectStatistical();
    }

    /**
     * 通过日期+基金id来查询净值统计
     * @param statisticsDate 日期
     * @param fundId 基金id
     * @return 返回净值统计对象的集合
     */
    @Override
    public List<ValusStatistical> selectStatisticalDate(String statisticsDate, String fundId) {
        return valusStatisticalMapper.selectStatisticalDate(statisticsDate,fundId);
    }

    /**
     * 根据日期加基金id来删除
     * @param statisticsDate 日期
     * @param fundId 基金id
     * @return int类型 1是删除成功，0是删除失败
     */
    @Override
    public int deleteStatistical(String statisticsDate, String fundId) {
        return valusStatisticalMapper.deleteStatistical(statisticsDate,fundId);
    }

    /**
     * 净值统计新增统计方法
     * @Param: ValueStatisticsMapper
     * @return 1为添加成功 0为失败
     */
    @Override
    public int insertStatistical(ValusStatistical valusStatistical) {
        return valusStatisticalMapper.insertStatistical(valusStatistical);
    }
}
